package com.secondweek.判断回文;

import java.util.Scanner;

/**
 * @description: 回文判断
 * @author: 十月
 * @create: 2020-11-29 11:19
 **/
public class first {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        System.out.println("请输入字符串：");
        String string=in.next();
        boolean flag=true;
        for (int i=0; i<string.length();i++)
        {
            if (string.charAt(i)!=string.charAt(string.length()-i-1))
            {
                flag=false;
            }
        }
        if (flag)
        {
            System.out.println("该字符串是回文！");
        }
        else
        {
            System.out.println("该字符串不是回文！");
        }
    }
}
